Polls

interface Polls

This module provides methods for using and managing polls in your Rooms.

The Polls interface offers functionality to interact with polls. Polls are always linked to a specific Room and pass through a set of states during all their lifetime. For this module, we distinguish 2 types of members of the room:

  • Users: Any member of the bubble who can vote when a poll is available

  • Organizers: Bubble organizers have access to the management part of a poll (create, start/stop...)

This interface can be used to:

  • Create, modify or delete polls: As an organizer, you can create new polls, you can modify existing polls or you can delete polls.

  • Start or stop polls: As an organizer, you can publish a poll so others can vote or you can finish a poll to have the final results.

  • Vote for an answer: As a user, you can vote for one or more answers when a poll has been started and until it is ended.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Interface defining callbacks for handling events related to poll changes within rooms.

Functions

Link copied to clipboard
abstract suspend fun createPoll(poll: Poll): RainbowResult<String>

Create a Poll in a Room.

Link copied to clipboard
abstract suspend fun deletePoll(pollId: String): RainbowResult<Unit>

Delete a poll, all data related to the poll are lost forever.

Link copied to clipboard
abstract suspend fun getPoll(pollId: String, roomId: String): RainbowResult<Poll>

Get a specific poll with its Id and the if of the room it is associated to.

Link copied to clipboard
abstract suspend fun getPollsForRoom(room: IRainbowRoom): RainbowResult<List<Poll>>

Get all the polls for a given room.

Link copied to clipboard
abstract suspend fun publishPoll(pollId: String): RainbowResult<Unit>

Publish a poll, opening the possibility for members to vote.

Link copied to clipboard
abstract fun registerChangeListener(pollChangeListener: Polls.PollChangeListener)

Registers a listener to monitor poll changes in rooms.

Link copied to clipboard
abstract suspend fun terminatePoll(pollId: String): RainbowResult<Unit>

End a poll, making it impossible to vote anymore.

Link copied to clipboard
abstract suspend fun unPublishPoll(pollId: String): RainbowResult<Unit>

Unpublish a poll, canceling the votes already made.

Link copied to clipboard
abstract fun unregisterChangeListener(pollChangeListener: Polls.PollChangeListener)

Unregisters a previously registered listener for poll changes in rooms.

Link copied to clipboard
abstract suspend fun updatePoll(poll: Poll): RainbowResult<Unit>

Update a Poll. The id in the poll needs to be one of an existing poll.

Link copied to clipboard
abstract suspend fun voteForPoll(pollId: String, votes: List<PollVote>): RainbowResult<Unit>

Submit the votes of the user for a poll.